Skip to content

chore(telemetry): add filter tracking for bulk ops COMPASS-10297#8015

Open
mabaasit wants to merge 2 commits intomainfrom
COMPASS-10297-bulk-actions-tracking
Open

chore(telemetry): add filter tracking for bulk ops COMPASS-10297#8015
mabaasit wants to merge 2 commits intomainfrom
COMPASS-10297-bulk-actions-tracking

Conversation

@mabaasit
Copy link
Copy Markdown
Collaborator

Description

Checklist

  • New tests and/or benchmarks are included
  • Documentation is changed or added
  • If this change updates the UI, screenshots/videos are added and a design review is requested
  • If this change could impact the load on the MongoDB cluster, please describe the expected and worst case impact
  • I have signed the MongoDB Contributor License Agreement (https://www.mongodb.com/legal/contributor-agreement)

Motivation and Context

  • Bugfix
  • New feature
  • Dependency update
  • Misc

Open Questions

Dependents

Types of changes

  • Backport Needed
  • Patch (non-breaking change which fixes an issue)
  • Minor (non-breaking change which adds functionality)
  • Major (fix or feature that would cause existing functionality to change)

Copilot AI review requested due to automatic review settings April 23, 2026 09:56
@mabaasit mabaasit requested a review from a team as a code owner April 23, 2026 09:56
@mabaasit mabaasit requested a review from Anemy April 23, 2026 09:56
async runBulkDelete() {
this.track('Bulk Delete Executed', {}, this.connectionInfoRef.current);
this.track(
'Bulk Delete Executed',
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think both of these events should be called either after the operation succeeds or just before it (dataservice call). In delete event we show a confirmation modal, to which user can ignore and we still track it. Similarly for update, if the query is invalid, we still track it.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds telemetry to track whether a filter was present when running bulk update and bulk delete operations.

Changes:

  • Extend Bulk Update Executed and Bulk Delete Executed telemetry event payloads with a has_filter boolean.
  • Populate the new has_filter field from the CRUD query bar state when executing bulk update/delete.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
packages/compass-telemetry/src/telemetry-events.ts Adds has_filter to bulk update/delete executed telemetry event payload definitions.
packages/compass-crud/src/stores/crud-store.ts Sends has_filter in telemetry when bulk update/delete operations are executed.

Comment on lines +1205 to +1207
{
isUpdatePreviewSupported: this.state.isUpdatePreviewSupported,
has_filter: !!this.queryBar.getLastAppliedQuery('crud').filter,
Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

has_filter is computed using !!...filter, but getLastAppliedQuery() returns a query object where filter is always an object (often {}), which is truthy. This will report has_filter: true even when no filter is set. Compute it like the existing Query Executed telemetry does (e.g., Object.keys(filter ?? {}).length > 0) by first grabbing const { filter } = this.queryBar.getLastAppliedQuery('crud').

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot is right here, filter can be {} which would be truthy. 'Query Executed' has the same pattern.

Comment thread packages/compass-crud/src/stores/crud-store.ts
Comment on lines 1022 to +1026
name: 'Bulk Delete Executed';
payload: Record<string, never>;
payload: {
/** Specifies if a filter was set in the query */
has_filter: boolean;
};
Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This event payload shape changed from {} to include has_filter. There are existing telemetry assertions in e2e tests that expect an empty payload / only isUpdatePreviewSupported (e.g., packages/compass-e2e-tests/tests/collection-bulk-delete.test.ts and collection-bulk-update.test.ts). These will fail until updated to assert the new property.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants